package com.okaixz.client.controller;


import com.okaixz.client.model.domain.KbUserAssistantInfo;
import com.okaixz.client.model.dto.KbUserAssistantAddAllDto;
import com.okaixz.client.service.IKbUserAssistantInfoService;
import com.okaixz.common.client.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cdz
 * @since 2025-05-26
 */
@RestController
@RequestMapping("/kb/userAssistant")
public class KbUserAssistantInfoController {
    @Autowired
    private IKbUserAssistantInfoService kbUserAssistantInfoService;
    @PostMapping("/list/{userId}/{sex}")
    public Result<List<KbUserAssistantInfo>> getListbyUserId(@PathVariable(name = "userId") String userId,@PathVariable(name = "sex") Integer sex){
        List<KbUserAssistantInfo> list = kbUserAssistantInfoService.getListbyUserId(userId,sex);
        return Result.success(list);
    }
    @PostMapping("/add")
    public Result<List<KbUserAssistantInfo>> add(@RequestBody KbUserAssistantInfo kbUserAssistantInfo){
        List<KbUserAssistantInfo> list = kbUserAssistantInfoService.add(kbUserAssistantInfo);
        return Result.success(list);
    }

    @PostMapping("/deleteByIds")
    public Result<List<KbUserAssistantInfo>> deleteByIds(@RequestBody KbUserAssistantAddAllDto params){
        List<KbUserAssistantInfo> resutlList = kbUserAssistantInfoService.deleteByIds(params);
        return Result.success(resutlList);
    }
    @PostMapping("/delete")
    public Result<List<KbUserAssistantInfo>> delete(@RequestBody KbUserAssistantInfo kbUserAssistantInfo){
        List<KbUserAssistantInfo> list = kbUserAssistantInfoService.delete(kbUserAssistantInfo);
        return Result.success(list);
    }

}
